#include "opewidget.h"

OpeWidget::OpeWidget(QWidget *parent)
    : QWidget{parent}
{
    m_pListw = new QListWidget(this);
    m_pListw->addItem("好友");
    m_pListw->addItem("图书");

    m_pFriend = new Friend;
    m_pBook = new Book;

    p_pSW = new QStackedWidget;
    p_pSW->addWidget(m_pFriend);
    p_pSW->addWidget(m_pBook);

    QHBoxLayout* m_pMain = new QHBoxLayout;
    m_pMain->addWidget(m_pListw);
    m_pMain->addWidget(p_pSW);

    setLayout(m_pMain);

    connect(m_pListw, SIGNAL(currentRowChanged(int)), p_pSW, SLOT(setCurrentIndex(int)));


}

OpeWidget &OpeWidget::getInstance()
{
    static OpeWidget instance;
    return instance;
}
